<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    const res = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve()
        }, 1000)
        // reject("异常穿透")
        // throw "手动抛出异常" 抛出字符串类型的异常，then的错误回调和catch可以处理
        // throw new Error("手动抛出异常") 抛出Error类型的异常，then的错误回调和catch可以处理
        // 抛出异常后Promise对象的状态变为rejected
    })
    console.log(res)
    const res2 = res.then (res => {
        console.log(res)
    }).then(res => {
        console.log(res)
    }).then(res => {
        console.log(res)
    }, err => {
        console.log(err)
        return "1"
    })
    console.log(res2)
</script>
</body>
</html>